﻿<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<?php
include("siteName.php");
$sOut = "<p>Welcome to the " . $siteName . " site";
if (isset($_SESSION["uName"])) {
$sOut .= ", " . $_SESSION["uName"];
}
$sOut .= "<br />Below there is a list of product categories. Click on one of them to be taken to the product listing that falls under it.</p>";
$catArray = array();
require("dbInc.php");
$mysqliObj = new mysqli($dbHost, $dbUser, $dbPass, $dbDB);
$sql = sprintf("select id, vCatName, vCatDescription from %s order by vCatName;", $tableCats);
$res = $mysqliObj->query($sql);
if ($res->num_rows > 0) {
while ($row = $res->fetch_assoc()) {
array_push($catArray, array("id"=>$row["id"], "vCatName"=>$row["vCatName"], "vCatDescription"=>str_replace("\'", "'", $row["vCatDescription"])));
}//end of looping through data rows
}//end of checking num rows
$mysqliObj->close();
?>
<title><?php echo $siteName; ?> - browse product categories</title>
<link type="text/css" rel="stylesheet" href="styles.css" />
</head>
<body>
<iframe name="logoFrame" id="logoFrame" src="logo.htm" border="0" height="120" align="top" frameborder="0" marginheight="0" width="100%" scrolling="no">
<a href="http://www.blindza.co.za/" target="_blank">
<img src="logo/blindza_logo_smaller46.jpg" alt="blindZA.co.za logo - white text on black background, with white border - and red braille version hovering in front of normal text" width="317" height="103" border="0" />
</a>
</iframe>
<a href="index.php">Back to entry page</a>
<h2><?php echo $siteName; ?> - browse product categories (<?php echo count($catArray); ?>)</h2>
<?php
if (count($catArray) > 0) {
echo $sOut;
?>
<ul>
<?php
foreach ($catArray as $cat) {
echo sprintf("<lit><a href='cat.php?id=%s' tooltip='%s'>%s</a></li>\n", $cat["id"], $cat["vCatDescription"], $cat["vCatName"]);
}//end of looping through catArray
?>
</ul>
<?php
}//end of checking if catArray has data
else {
echo "<p>There are currently no product categories to browse.</p>";
}
?>
</body>
</html>
